package com.cropdoctor.model.po;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

@Data
@EqualsAndHashCode(callSuper = false)
@TableName("sys_user")
@ApiModel(value = "SysUserPo",description = "用户相关Po")
public class SysUserPo {

    // ==================== FIELDS ====================
    @TableId(value = "id",type = IdType.AUTO)
    private Integer id;

    /**
     * 账号
     */
    @TableField(value = "account")
    @ApiModelProperty(value = "账号",example = "3226016000")
    private String account;

    /**
     * 用户名
     */
    @TableField(value = "user_name")
    @ApiModelProperty(value = "用户昵称",example = "生姜烧肉")
    private String userName;

    /**
     * 用户密码
     */
    @TableField(value = "password")
    @ApiModelProperty(value = "密码",example = "123")
    private String password;

    /**
     * 上一次登录时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS", timezone = "GMT+8")
    @TableField(value = "last_login_time")
    @ApiModelProperty(value = "上次登录时间",example = "2024:2:15:10:54:27")
    private LocalDateTime lastLoginTime;

    /**
     * 账号是否可用。默认为1（可用）
     */
    @TableField(value = "enabled")
    @ApiModelProperty(value = "禁用状态（1为启用，0为禁用）",example = "1")
    private Integer enabled;

    // ==================== NON-PERSISTENT ====================
    @TableField(exist = false)
    @ApiModelProperty(value = "用户所拥有的权限")
    private List<String> authorities;

    @TableField(exist = false)
    @ApiModelProperty(value = "JWT令牌")
    private String token;
    @ApiModelProperty(value = "微信登录唯一标识")
    private String openid;
    @ApiModelProperty(value = "头像图片路径")
    private String avatarUrl;
    private String unionid;
    private String sessionKey;
    @ApiModelProperty(value = "用户性别",example = "1")
    private int gender;
    @ApiModelProperty(value = "用户所属国家",example = "中国")
    private String country;
    @ApiModelProperty(value = "用户所属省份",example = "福建")
    private String province;
    @ApiModelProperty(value = "用户所属城市",example = "泉州")
    private String city;

    // ==================== GET AND SET METHODS ====================

}
